package dto

import (
	"comm/selfreg"
	"core/class"
	"reflect"
)

type PropValueTreeDto struct {
	Id string `json:"id"                         gorm:"column:id;primaryKey;comment:主键;autoIncrement:false;"`

	Sid string `json:"sid"   bson:"sid"                          gorm:"column:sid;size:50;comment:联网网关;"`
	Did string `json:"did"      bson:"did"                     gorm:"column:sid;size:50;comment:设备编号;"`
	Pid string `json:"pid"      bson:"pid"                     gorm:"column:pid;size:50;comment:属性编号;"`

	Name string `json:"name"         validate:"required,max=50"gorm:"column:name;size:50;DEFAULT:'';not null;comment:菜单名称;"`

	Lx string `json:"lx"           validate:"max=10"   gorm:"column:lx;size:10;DEFAULT:'';not null;comment:类型;memo:目录、菜单、权限;"`

	// 10 固定属性  20 检测状态    30 检测值   40 有状态的检测值属性   50 可配置属性
	Type uint8 `json:"type"    bson:"type"                       gorm:"column:prop_type;comment:属性类型;"`

	Scope string `json:"scope"   bson:"scope"      gorm:"column:scope;size:40;comment:监测范围;"`
	Unit  string `json:"unit"  bson:"unit"       gorm:"column:unit;size:10;comment:单位;"`

	Fv float32 `json:"fv"      bson:"fv"                      gorm:"column:prop_id;size:10;comment:数值;"`
	Sv string  `json:"sv"           bson:"sv"               gorm:"column:prop_id;size:10;comment:显示值;"`
	//正常、30.0  显示值  启动、故障、停止
	State string `json:"state"  bson:"state"       gorm:"column:state;size:10;comment:状态;"`
	//正常、故障、一级警情、二级警情
	CrtDt string `json:"crtDt"    bson:"crtDt"     gorm:"column:crtDt;size:20;comment:日期;"`

	Children *[]PropValueTreeDto `json:"children"                         gorm:"-;comment:children;"`
}

func init() {
	var mcls = &PropValueTreeDto{}
	var m = &class.MyClass{
		Name:     "设备属性树形结构Dto",
		Ename:    "",
		FullName: "",
		Memo:     "",
		Fileds:   nil,
		PrjName:  "",
		Type:     reflect.TypeOf(mcls),
	}
	selfreg.AddDto(m)
}
